export default server => {
	const {
		app: { schemaComposer },
	} = server;

	schemaComposer.Query.addFields({
		VulPluginId: {
			description: '检测插件ID查询',
			type: schemaComposer
				.createObjectTC({
					name: 'VulPluginId',
					fields: {
						id: 'String!',
						label: 'String!',
						category: 'String!',
						taskType: 'String!',
					},
				})
				.getTypePlural(),
			args: {
				taskType: 'String',
			},
			async resolve(root, args, { request }) {
				const {
					server: {
						methods: { getVulPluginList },
					},
				} = request;

				return getVulPluginList();
			},
		},
		VulPluginCategory: {
			description: '检测插件类别',
			type: 'JSON',
			async resolve(root, args, { request }) {
				const {
					server: {
						methods: { getVulPluginCategory },
					},
				} = request;

				return getVulPluginCategory();
			},
		},
	});
};
